ALAG3D performs an interpolation of the function U=U(x,y) defined on a 4 x 4 or larger grid by performing a weighted averaging of eight Lagrangian interpolations in the area of the point of interest. The X values and the Y values need not be uniformly spaced and ΓêåX need not equal ΓêåY. ALAG3D requires the passage of an X and Y array, the X and Y array size, a 2d Z array and the points XIN, YIN for which the interpolation is to be done.
TYPE REQUIREMENTS
CONST
NUMX = maximum number of X data points-1;
{may be larger than XSIZE}
NUMY = maximum number of Y data points-1;
{may be larger than YSIZE}
Type
FLOAT = REAL or DOUBLE or EXTENDED;
DATAX = ARRAY [1..NUMX] of FLOAT;
DATAY = ARRAY [1..NUMY] of FLOAT;
RECTANG = ARRAY [0..NUMX,0..NUMY] of FLOAT;
FIXXED = INTEGER or LONGINT;
CALLING PROCEDURE
var
X:DATAX;{Known X values}
Y:DATAY;{Known Y values}
Z:RECTANG;{Known Z values}
XSIZE,YSIZE FIXXED;{Size of X AND Y array}
X0,Y0,Z0:FLOAT;{Input points and output point for the interpolation}
DEFINE X,Y and Z arrays.
Pick the points for interpolation X0, Y0.
Z0:=INTERP2D(X0,Y0,X,Y,Z,NUMX,MUNY);
EXAMPLE
The example routine defines Z as Z=sin(x)*cos(y) on a 10 X 10 grid. X and Y range from 0 to (9/5)∏. The output of ALAG3D is then used to generate a
three dimensional plot of the function from X = 0 to (28/15)∏, Y = 0 to (19/20)∏. The function is plotted using the procedure PLOT3. PLOT3 will scale and plot to a point or scale and move to a point from the current pen position given the point (x,y,z) and three Euler angles (alpha,beta,gamma). It assumes the screen limits have been defined as XMIN,XMAX,YMIN,YMAX. To get PLOT3 to move to a point without drawing set color equal to 0. If color is 1 then the line will be drawn. The calling procedure for PLOT3 is
PLOT3(x,y,z,alpha,beta,gama,color);
x, y, z, alpha, beta, and gamma are of type float. Color is of type integer.
REFERENCES
James, M. L., Smith, G. M., Wolford, J. C.: Applied Numerical Methods for Digital Computation With Fortran and CSMP, Harper and Row, New York, 1977.
Spiegel, M. R..: Mathematical Handbook of Formulas and Tables, McGraw-Hill, New York, 1968.
-- part contents for background part 26
----- text -----
5
-- part contents for background part 6
----- text -----
PROGRAM TEST_ALAG3D;
TYPE
FLOAT = REAL;
DATA = ARRAY[1..20] OF FLOAT;
RECTANG = ARRAY[1..20, 1..20] OF FLOAT;
FIXXED = INTEGER;
VAR
X0, Y0, Z0, XMAX, XMIN, YMAX, YMIN, A, B, C : FLOAT;